/**
 * Created by liuhailun on 2017/6/21.
 */

   
//校验手机号码
function validatemobile(mobile) {
	var myreg = /^(13[0-9]|14[579]|15[0-3,5-9]|16[6]|17[0135678]|18[0-9]|19[89])\d{8}$/;
	if (mobile.length == 0) {
		return false;
	} else if (mobile.length != 11) {
		return false;
	} else if (!myreg.test(mobile)) {
		return false;
	} else {
		return true;
	}
} 

function num(obj){
	obj.value = obj.value.replace(/[^\d.]/g,""); //清除"数字"和"."以外的字符
	obj.value = obj.value.replace(/^\./g,""); //验证第一个字符是数字
	obj.value = obj.value.replace(/\.{2,}/g,"."); //只保留第一个, 清除多余的
	obj.value = obj.value.replace(".","$#$").replace(/\./g,"").replace("$#$",".");
	obj.value = obj.value.replace(/^(\-)*(\d+)\.(\d\d).*$/,'$1$2.$3'); //只能输入两个小数
}


function validationEmail(email){
	 var reg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
     isok= reg.test(email );
     if (!isok) {
       return false;
     }else{
    	 return true;
     }
}
